package com.zj.osm.entity.greendao;

import com.zj.osm.entity.db.DaoSession;
import com.zj.osm.entity.db.LineDao;
import com.zj.osm.entity.db.PointDao;
import com.zj.osm.entity.db.ProjectDao;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Index;
import org.greenrobot.greendao.annotation.ToMany;

import java.util.ArrayList;
import java.util.List;

/**
 * 项目类 和点、线一对多
 *
 * @author jiang zhu on 2019/10/24
 */
@Entity
public class Project {
    @Id
    private Long id;

    //在线项目的id cid
    private String projectId;

    //项目的名称
    private String name;

    //项目的创建时间
    private String time;

    //项目的备注
    private String note;

    //单位信息
    private String unit;

    //是否选中
    private boolean isCheck;

    //电压等级
    private String voltage;

    //建设类型
    private String type;

    //批量操作
    private int batchCheck;

    //项目状态
    private String state;

    //是否勘察完毕 0为未勘察完毕  1为完毕
    private String stop;

    //选型杆塔的类别ID  ModuleTypeID
    private String ganxinModuleTypeId;
    //杆型ID[非预应力,整根杆，12m,190mm，N]
    private String ganxinModuleId;
    //架空类别Id
    private String jiakongEquipId;
    //架空线路ID
    private String jiakongModuleId;
    //电缆类别Id
    private String dilanEquipId;
    //电缆线路ID
    private String dilanModuleId;
    //电缆直埋
    private String path;

    //项目中的点
    @ToMany(referencedJoinProperty = "projectId")
    private List<Point> pointList = new ArrayList<>();

    //项目中的线
    @ToMany(referencedJoinProperty = "projectId")
    private List<Line> lineList = new ArrayList<>();

    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;

    /** Used for active entity operations. */
    @Generated(hash = 1378029107)
    private transient ProjectDao myDao;

    @Generated(hash = 1076968367)
    public Project(Long id, String projectId, String name, String time, String note, String unit,
            boolean isCheck, String voltage, String type, int batchCheck, String state, String stop,
            String ganxinModuleTypeId, String ganxinModuleId, String jiakongEquipId,
            String jiakongModuleId, String dilanEquipId, String dilanModuleId, String path) {
        this.id = id;
        this.projectId = projectId;
        this.name = name;
        this.time = time;
        this.note = note;
        this.unit = unit;
        this.isCheck = isCheck;
        this.voltage = voltage;
        this.type = type;
        this.batchCheck = batchCheck;
        this.state = state;
        this.stop = stop;
        this.ganxinModuleTypeId = ganxinModuleTypeId;
        this.ganxinModuleId = ganxinModuleId;
        this.jiakongEquipId = jiakongEquipId;
        this.jiakongModuleId = jiakongModuleId;
        this.dilanEquipId = dilanEquipId;
        this.dilanModuleId = dilanModuleId;
        this.path = path;
    }

    @Generated(hash = 1767516619)
    public Project() {
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getProjectId() {
        return this.projectId;
    }

    public void setProjectId(String projectId) {
        this.projectId = projectId;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTime() {
        return this.time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getNote() {
        return this.note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public String getVoltage() {
        return this.voltage;
    }

    public void setVoltage(String voltage) {
        this.voltage = voltage;
    }

    public String getType() {
        return this.type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getStop() {
        return this.stop;
    }

    public void setStop(String stop) {
        this.stop = stop;
    }

    @Override
    public String toString() {
        return "Project{" +
                "id=" + id +
                ", projectId='" + projectId + '\'' +
                ", name='" + name + '\'' +
                ", time='" + time + '\'' +
                ", note='" + note + '\'' +
                ", unit='" + unit + '\'' +
                ", isCheck=" + isCheck +
                ", voltage='" + voltage + '\'' +
                ", type='" + type + '\'' +
                ", batchCheck=" + batchCheck +
                ", state='" + state + '\'' +
                ", stop='" + stop + '\'' +
                ", ganxinModuleTypeId='" + ganxinModuleTypeId + '\'' +
                ", ganxinModuleId='" + ganxinModuleId + '\'' +
                ", jiakongEquipId='" + jiakongEquipId + '\'' +
                ", jiakongModuleId='" + jiakongModuleId + '\'' +
                ", dilanEquipId='" + dilanEquipId + '\'' +
                ", dilanModuleId='" + dilanModuleId + '\'' +
                ", path='" + path + '\'' +
                ", pointList=" + pointList +
                ", lineList=" + lineList +
                ", daoSession=" + daoSession +
                ", myDao=" + myDao +
                '}';
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 92979459)
    public List<Point> getPointList() {
        if (pointList == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            PointDao targetDao = daoSession.getPointDao();
            List<Point> pointListNew = targetDao._queryProject_PointList(id);
            synchronized (this) {
                if (pointList == null) {
                    pointList = pointListNew;
                }
            }
        }
        return pointList;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 18518400)
    public synchronized void resetPointList() {
        pointList = null;
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 955630812)
    public List<Line> getLineList() {
        if (lineList == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            LineDao targetDao = daoSession.getLineDao();
            List<Line> lineListNew = targetDao._queryProject_LineList(id);
            synchronized (this) {
                if (lineList == null) {
                    lineList = lineListNew;
                }
            }
        }
        return lineList;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 847648996)
    public synchronized void resetLineList() {
        lineList = null;
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }


    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 2081800561)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getProjectDao() : null;
    }

    public String getState() {
        return this.state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getUnit() {
        return this.unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public boolean getIsCheck() {
        return this.isCheck;
    }

    public void setIsCheck(boolean isCheck) {
        this.isCheck = isCheck;
    }

    public int getBatchCheck() {
        return this.batchCheck;
    }

    public void setBatchCheck(int batchCheck) {
        this.batchCheck = batchCheck;
    }

    public String getGanxinModuleTypeId() {
        return this.ganxinModuleTypeId;
    }

    public void setGanxinModuleTypeId(String ganxinModuleTypeId) {
        this.ganxinModuleTypeId = ganxinModuleTypeId;
    }

    public String getGanxinModuleId() {
        return this.ganxinModuleId;
    }

    public void setGanxinModuleId(String ganxinModuleId) {
        this.ganxinModuleId = ganxinModuleId;
    }

    public String getJiakongEquipId() {
        return this.jiakongEquipId;
    }

    public void setJiakongEquipId(String jiakongEquipId) {
        this.jiakongEquipId = jiakongEquipId;
    }

    public String getJiakongModuleId() {
        return this.jiakongModuleId;
    }

    public void setJiakongModuleId(String jiakongModuleId) {
        this.jiakongModuleId = jiakongModuleId;
    }

    public String getDilanEquipId() {
        return this.dilanEquipId;
    }

    public void setDilanEquipId(String dilanEquipId) {
        this.dilanEquipId = dilanEquipId;
    }

    public String getDilanModuleId() {
        return this.dilanModuleId;
    }

    public void setDilanModuleId(String dilanModuleId) {
        this.dilanModuleId = dilanModuleId;
    }

    public String getPath() {
        return this.path;
    }

    public void setPath(String path) {
        this.path = path;
    }
}
